package com.example.cs4.model;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import java.util.Date;

@Data
@Entity
@Table(name = "chat_history")
@ApiModel(description = "聊天记录")
public class ChatHistory {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @ApiModelProperty(value = "聊天记录ID")
    private Integer id;

    @ApiModelProperty(value = "发送者")
    private String sender;

    @ApiModelProperty(value = "接收者")
    private String receiver;

    @ApiModelProperty(value = "消息内容")
    @Column(columnDefinition = "TEXT")
    private String message;

    @ApiModelProperty(value = "文件类型")
    private String fileType;

    @ApiModelProperty(value = "文件内容")
    @Column(columnDefinition = "LONGTEXT")
    private String file;

    @ApiModelProperty(value = "文件名")
    private String filename;

    @ApiModelProperty(value = "发送时间")
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", timezone="GMT+8")
    private Date timestamp;

    @ApiModelProperty(value = "语音内容")
    @Column(columnDefinition = "LONGTEXT")
    private String voice;

    @ApiModelProperty(value = "语音类型")
    private String voiceType;

    @ApiModelProperty(value = "语音文件名")
    private String voiceFilename; // 添加语音文件名字段
    @ApiModelProperty(value = "是否已读")
    private Boolean isRead;
}
